package com.panopset.sf.jnlp;

import java.awt.Component;
import java.awt.Dimension;
import java.awt.Graphics2D;
import java.awt.Rectangle;

import com.panopset.sf.Osgw;
import com.panopset.sf.PopupBox;
import com.panopset.sf.SwingFrame;

/**
 * Organization customization level of inheritance chain.
 * 
 * @author Karl Dinwiddie
 * 
 */
public abstract class AbstractPanopsetSwingFrame extends SwingFrame {

	private static int WIDTH = 256;

	@Override
	public PopupBox createAboutBox() {
		PopupBox rtn = new PopupBox() {

			@Override
			public Dimension createSize() {
				return new Dimension(WIDTH, WIDTH);
			}

			@Override
			public Component createComponent() {
				return new Osgw(getSize()) {
					@Override
					public void paintCycle(final Graphics2D g) {
						getCyclotron().paint(g);
					}
				}.getPanel();
			}
		};
		rtn.addLink(new Rectangle(0, WIDTH - (WIDTH / 6), WIDTH, WIDTH),
				"http://panopset.com");
		return rtn;
	}

	private Cyclotron cy;

	private Cyclotron getCyclotron() {
		if (cy == null) {
			cy = new Cyclotron(WIDTH, WIDTH);
		}
		return cy;
	}
}
